home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #2 / Monster Media No. 2 (Monster Media)(1994).ISO / maximus / cdcar202.zip / CDMAINT.CMD < prev    next >
OS/2 REXX Batch file  |  1994-06-12  |  17KB  |  26 lines

  1. /*                         CD Carousel Door                                */;/*                              v2.02                                      */ ;/*                         by Bill Esposito                                */  ;/*                       The Cereal Port BBS                               */;/*                            1:132/152                                    */;/*                           (603)899-3335                                 */;/*                                                                         */;/*                         Magic name 'CDCAR'                              */;/*                         for latest version                              */;/*                                                                         */;/* *********************************************************************** */;/* DISCLAIMER:  This software is provided "AS IS" without any warranty of  */;/* any kind, either expressed or implied.  USE IT AT YOUR OWN RISK.        */;/*                                                                         */;/* Copyright 1993 by Bill Esposito.  This program is SHAREWARE.    Please  */;/* read the file SHAREWRE.TXT included in this archive.                    */;/* *********************************************************************** */;/*                   *****    CDMAINT.CMD   *****                          */;/* Utility to copy requested files to the BBS, update the files.bbs, and d */;/* send an acknowlegement message to the user.                             */
  2. /***************************************************************************/;Arg me def;def1=def;config=cdcar.cfg;'@echo off' ;f=1;do until lines(config)=0;  param.f=linein(config);  f=f+1;end;ok=stream(config,c,'close');parse var param.3 homedir junk;parse var param.4 maxdir junk;parse var param.5 download junk;parse var param.6 fnum junk;parse var param.7 type junk;parse var param.8 marea junk;parse var param.9 tnode junk;parse var param.10 fnode junk;parse var param.11 sysopfirst sysoplast junk
  3. parse var param.14 private junk;parse var param.15 pl junk;parse var param.17 standalone junk;/* parse var param.18 defaultcd junk  */;configcd=homedir''cdcar.cfg;f=1;do until lines(configcd)=0;  if f > 17 then default.f=linein(configcd);  else scrap=linein(configcd);  f=f+1;end;cdes=f-17 ;ok=stream(configcd,c,'close');sys=homedir''cdcar.sys;f=1;;qt=1;fi.1='';fi.2='';fi.3=''
  4. fi.4='';fi.5='';fi.6='';fi.7='';fi.8='';fi.9='';fi.10='';;angrn=''      ;anyel=''      ;anred=''      ;anblu=''      ;ancyan=''     ;anbrt=''    ;angry='' ;anlo=''  ;;yel='ÅÄ' ;mag=''     ;grn='é'     
  5. cyan='â'    ;               ;uold='1time';if def=1 then tb='';call RxFuncAdd 'SysloadFuncs','RexxUtil','Sysloadfuncs';call sysloadfuncs;file=homedir'disk.lst'   ;;ok=stream(file,c,'close');do until lines(file)=0;   PARSE VALUE linein(file) with priv lock disk diskdesc;   u=1;   paramno=17;   do while u < cdes;       paramno=paramno+1;       parse upper var default.paramno dcd2 junk;       parse upper var disk curcd;       if dcd2=curcd then dcd=curcd;       u=u+1;   end    
  6.    if dcd=curcd then def=1 ;   else def=0;   if def <>1 then if def1 <> 1 then call insert;   call move;   ok=stream(file1,c,'close');   call sysfiletree file1,'stem.','F';   if def=1 then if stem.0<>0 then del homedir''disk'.def >nul';   if stem.0<>0 then if def <> 1 then del homedir''disk'.req >nul'; end;if def <> 1 then if def1 <>1 then call default;if me=1 then call cdmenu.cmd;exit          ;;move:  ;if def=1 then file1=homedir''disk'.def';else file1=homedir''disk'.req';if def1=1 then file1=homedir''disk'.def';ok=stream(file1,c,'close')  ;call sysfiletree file1,'stem.','F';if stem.0<>1 then return
  7. ok=stream(file1,c,'open')  ;do until lines(file1)=0;    parse value linein(file1) with nmi alias three four five six seven eight nine ten eleven twelve;    if alias='YES' then do;      first=three;      mid='';      last='';      priv=four;      lock=five;      directory=six;      filename=seven;      size=eight;      datee=nine;      desc=ten eleven twelve;    end;    if nmi='YES' then if alias='NO' then do;      first=three;      mid='';      last=four;      priv=five
  8.       lock=six;      directory=seven;      filename=eight;      size=nine;      datee=ten;      desc=eleven twelve;    end;    if nmi='NO' then if alias='NO' then do;      first=three;      mid=' 'four;      last=five;      priv=six;      lock=seven;      directory=eight;      filename=nine;      size=ten;      datee=eleven;      desc=twelve;    end;priva=priv
  9. locka=lock    ;    ;        uname = FIRST||MID LAST ;        if uold = '1time' then oldfirst=first;        if uold = '1time' then uold=uname;        if uname<>uold then call mail;        else if qt > 10 then call mail ;    oldfirst=first;  /*  uname=uold */;    cls;    if directory='' then directory=poop;    dr=homedir||disk'\names.lst';    ok=stream(dr,c,'close');    call sysfilesearch directory,dr,'good.';    if good.0<>0  then do ;      if all<>'A'then if def <> 1 then do;       if pl=0 then do ;       call status1;         say;         say anbrt||ancyan'The file 'anblu||filename||ancyan' was requested by 'anred||FIRST||MID LAST||ancyan
  10.          say 'The current Privilege is 'anred||priv||ancyan' and the current Lock is 'anred||lock||ancyan;         say 'Do you wish to change this? (y,N,'anyel'ne'ancyan'v'anyel'er'ancyan')';         say;         say 'Enter neVer if you want to skip this question for all files. ';         say;         say'                    Select:';         call syscurpos 7, 27;         pull ans;         answer=left(ans,1);         if answer = '' then answer = 'N' ;         if answer='V' then all='A'  ;          if answer = 'Y' then do;            cls;            say;            say anblu'If a file is already online, the priv/lock will not be changed'ancyan;            say;            say ' The current Privilege is 'anred||priv||ancyan', Enter the new privilege';            say ' (T,D,L,N,W,P,F,E,C,A,S, <ENTER> for no change)';            pull newpriv;             if newpriv <>'T' then if newpriv <>'D' then if newpriv <>'L' then if newpriv <>'N' then if newpriv <>'W' then if newpriv <>'P' then if newpriv <>'F' then if newpriv <>'E' then if newpriv <>'C' then if newpriv <>'A' then if newpriv <>'S' then if newpriv <>'' then newpriv=''
  11.             say ' The current Lock is 'anred||lock||ancyan', Enter the new lock';            say ' 1,2,3,4,5,6,7,8,% for none,<ENTER> for no change)';            pull newlock;             if newlock >8 then if newlock <> '%' then if newlock <>'' then newlock = '';          end ;    if newpriv <>'' then if newpriv <>'NEWPRIV' then if answer='Y' then priv=newpriv;    if newlock <>'' then if newlock <>'NEWLOCK' then if answer='Y' then lock=newlock;    call status;      end;  if pl=1 then do;         say;         say anbrt||ancyan'Do you want 'anblu||filename||ancyan' to be a free download for 'anred||FIRST||MID LAST||ancyan'?';         say '                   1. Free Time (/t) ';         say '                   2. Free Bytes(/b) ';         say '                   3. Both Free (/tb)';         say '                   4. Full Charge (nothing added to files.bbs)' ;         say;         say ' Add an "a" to your selection if you want this for ALL files. (ex. 2a)';         say;         say'                    Select:'
  12.          pull ans;         answer=left(ans,1);         if length(ans)=2 then do;            all=right(ans,1);         end   ;           if answer=1 then tb='/t';           if answer=2 then tb='/b';           if answer=3 then tb='/tb';           if answer=4 then tb='';           if datatype(answer)<>"NUM" then tb='';           if answer <1 then if answer >4 then tb=''    ;           if all='A'then this='ALL files';               else this='this file';         bt=tb;         if tb='' then bt='nothing'      ;         say;         say ' Ok, 'bt' will be added to the files.bbs for 'this;         say;end;end
  13. end;copy:      ;   if all='A' then call status;   if def=1 then call status;   file3=download''filename;   call sysfiletree file3,'stem3.','F';;   if stem3.0=0 then do; ;      copy directory'\'filename download;      say 'Updating Files.bbs with 'filename;      call lineout homedir'request.log',uname'    'filename'    'date();      call lineout maxdir'names.dl',filename uname;   end;        else rc=0;   if stem3.0=1 then do;   b=1;   call sysfiletree download'files.car','stem6.','F';   if stem6.0<>0 then '@del' download'files.car >nul'     ;   
  14.     ok=stream(download'files.bbs',c,'close');     do until lines(download'files.bbs')=0;        bbsfile.b=linein(download'files.bbs');        if pl=0 then do;        parse var bbsfile.b priv filnamc rest;        filnams=strip filnamc;        legth=length(filnamc);        if legth < 9 then filnam=filnamc;        else filnam=right(filnamc,(legth-8));        end;        if pl=1 then parse var bbsfile.b filnam rest;        if filnam=filename then do;           bbsfiler.b=reverse(bbsfile.b);           parse var bbsfiler.b qtt rest;           qtt=reverse(qtt)+1;           bbsfiler.b = strip(rest);           bbsfile.b=reverse(bbsfiler.b) qtt;           say 'Updating Files.bbs with 'filename;           call lineout homedir'request.log',uname'    'filename'    'date();           call lineout maxdir'names.dl',filename uname
  15.         end;         call lineout download'files.car', bbsfile.b;         b=b+1;       end;        end ;            ok=stream(download'files.bbs',c,'close');    ok=stream(download'files.car',c,'close')   ;  call sysfiletree download'files.car','stem4.','F';  if stem4.0<>0 then do;    '@copy' download'files.car' download'files.bbs >nul';    '@del' download'files.car >nul'     ;  end      ;;         ca='';           if rc <> 0 then if def1 <> 1 then do ;          say;          say 'Error copying file.  This usually means you have the wrong CD inserted';          say;          say 'Either correct the problem and then hit "C" for continue, or hit "A" to abort';          say 'this file'
  16.           pull ca;          if ca = 'C' then copy directory'\'filename download;          else nop;            if rc <>0 then if ca <> 'A' then if def1 <> 1 then do;              say;              say 'There is still an error, the file was not copied.';              say 'Press <enter> to continue';              pull ent;              ca='A';            end;              if rc <>0 then if ca = 'A' then do;              call lineout homedir'errors.log', disk nmi alias first mid last priva locka directory filename size datee desc ;                  /* call lineout homedir'errors.log', directory'\'filename' 'disk' 'uname*/ ;;                ok=stream(homedir'errors.lst',c,'close');              end;         end;      if rc=0 then if stem3.0=0 then do;        attrib '-r' download''filename '>nul';        fbbs= download'files.bbs'
  17.          if pl=0 then call lineout download||files.bbs,priv||lock||yel||left(filename,13)||mag||right(size,8)||grn||right(datee,9)'  'cyan||strip(desc)' 1';        if pl=1 then  call lineout download||files.bbs,filename tb strip(desc)' 1';          end;        data=left(filename,12)'  'desc;           if ca <> 'A' then call merge;     /* end        */; /*   end  */;  end;if ca <> 'A' then call mail;    ;return;insert:;file1=homedir''disk'.req';ok=stream(file1,c,'close');;call sysfiletree file1,'stem.','F';;if stem.0<>1 then return;cls;say
  18. say;say;say;say'  Please insert the CD labled 'disk 'into the drive.';say;say'  Press any key when ready';pull any;uold='1time';return;;default:;cls;say;say;say;say;say'  Please insert the Original CD into the drive.';say;say'  Press any key when ready';pull any
  19. return;mail:;if def=1 then return;if standalone=1 then return;hdr='Hello 'OLDFIRST',';tail='---  Files brought to you by CD Carousel';sig='  Enjoy `em,';/* MSGAPI */;address CMD 'rxsubcom drop msgapi';address CMD 'rxsubcom register MSGAPI rxmsgapi RXMSGAPI';address CMD 'rxsubcom load MSGAPI RXMSGAPI';address MSGAPI;'OPEN_API 3 0';'OPEN_AREA MSG 'marea' MSGAREA_NORMAL 'TYPE;'LOCK MSG';'OPEN_MSG MSGH MSG MOPEN_CREATE 0';cr = '0d'x;if fi.1 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.2 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.3 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr cr sig cr '    'sysopfirst cr cr tail cr
  20. if fi.4 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.5 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.6 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.7 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.8 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.9 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr fi.9 cr cr sig cr '    'sysopfirst cr cr tail cr;if fi.10 <>'' then text = hdr cr cr 'The following file(s) are waiting for you in File Area 'fnum'.' cr cr fi.1 cr fi.2 cr fi.3 cr fi.4 cr fi.5 cr fi.6 cr fi.7 cr fi.8 cr fi.9 cr fi.10 cr cr sig cr '    'sysopfirst cr cr tail cr;controla = '01'x;control = controla || 'PID RXMSGAPI';xmsg.attr = private;xmsg.from = SYSOPFIRST SYSOPLAST;xmsg.to = strip(uold);xmsg.subj = 'Your File Request';xmsg.orig = tnode;xmsg.dest = fnode;hour=time('N');date2=date('S');year=left(date2,4);month=substr(date2,5,2);day=right(date2,2)
  21. date1=year'/'month'/'day':'hour;xmsg.date_written = date1;xmsg.date_arrived = date1;xmsg.utc_ofs = 60;xmsg.replyto = 0;xmsg.replies.1 = 0;xmsg.replies.2 = 0;xmsg.replies.3 = 0;xmsg.replies.4 = 0;xmsg.replies.5 = 0;xmsg.replies.6 = 0;xmsg.replies.7 = 0;xmsg.replies.8 = 0;xmsg.replies.9 = 0;xmsg.replies.10 = 0;xmsg.ftsc_date = date('N') time('N');'WRITE_MSG MSGH 0 XMSG. TEXT' length(text) length(text) length(control) 'CONTROL';'CLOSE_MSG MSGH';'UNLOCK MSG';'CLOSE_AREA MSG'
  22. 'CLOSE_API';address CMD 'rxsubcom drop msgapi';call syssleep 3;fi.1='';fi.2='';fi.3='';fi.4='';fi.5='';fi.6='';fi.7='';fi.8='';fi.9='';fi.10='';qt=1;uold=uname;return;;merge:;fi.qt = data;qt=qt+1
  23. return;;status:;if left(priv,1)='T' then priv=0;if left(priv,1)='D' then priv=1;if left(priv,1)='L' then priv=2;if left(priv,1)='N' then priv=3;if left(priv,1)='W' then priv=4;if left(priv,1)='P' then priv=5;if left(priv,1)='F' then priv=6;if left(priv,1)='E' then priv=7;if left(priv,1)='C' then priv=8;if left(priv,1)='A' then priv=9;if left(priv,1)='S' then priv=10;IF priv=0 then priv ='LT';IF priv=1 then priv ='LD';IF priv=2 then priv ='LL';IF priv=3 then priv ='LN';IF priv=4 then priv ='LW';IF priv=5 then priv ='LP'
  24. IF priv=6 then priv ='LF';IF priv=7 then priv ='LE';IF priv=8 then priv ='LC';IF priv=9 then priv ='LA';IF priv=10 then priv ='LS';IF lock= 1 then lock ='kI1 ';IF lock= 2 then lock ='kI2 ';IF lock= 3 then lock ='kI3 ';IF lock= 4 then lock ='kI4 ';IF lock= 5 then lock ='kI5 ';IF lock= 6 then lock ='kI6 ';IF lock= 7 then lock ='kI7 ';IF lock= 8 then lock ='kI8 ';IF lock= '%' then lock=' ';if left(lock,1)='N' then lock=' ';return;status1:;IF priv=0 then priv ='Twit';IF priv=1 then priv ='Disgrace';IF priv=2 then priv ='Limited'
  25. IF priv=3 then priv ='Normal';IF priv=4 then priv ='Worthy';IF priv=5 then priv ='Privel';IF priv=6 then priv ='Favored';IF priv=7 then priv ='Extra';IF priv=8 then priv ='Clerk';IF priv=9 then priv ='AstSysop';IF priv=10 then priv ='Sysop';IF lock= '' then lock='None';IF lock= '%' then lock='None';return;IN.492;IN.493;IN.494;IN.495;IN.496;IN.497;IN.498;IN.499;IN.500
  26.